package com.glory.cqaospda.viewmodel

import com.glory.cqaospda.model.TaskRepository
import com.glory.mvvmnet.base.BaseViewModel
import com.glory.mvvmnet.entity.CallObserveBean
import com.google.gson.JsonObject

class InspectModel : BaseViewModel() {

    private val repository by lazy { TaskRepository() }

    fun defaultSendCheck(map: JsonObject) {
        launchOnlyResult({
            repository.defaultSendCheck(map, "EMS_SendCheck")
            defUI.callObserve.value = CallObserveBean(1)
        })
    }

    fun defaultSpotCheckInfo(map: JsonObject) {
        launchOnlyResult({
            val spotcheckinfobean = repository.defaultSpotCheckInfo(map, "EMS_SpotCheckInfo")
            defUI.callObserve.value = CallObserveBean(2,spotcheckinfobean)
        })
    }

    fun defaultCancelBuyoff(map: JsonObject) {
        launchOnlyResult({
            val spotcheckinfobean = repository.defaultCancelBuyoff(map, "EMS_CancelBuyoff")
            defUI.callObserve.value = CallObserveBean(2,spotcheckinfobean)
        })
    }
}